<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>添加角色</title>
    <meta name="context-path" th:content="@{/}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/bootstrap.min.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/bootstrap-responsive.min.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/colorpicker.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/datepicker.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/uniform.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/select2.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/matrix-style.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/matrix-media.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/matrix-full.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/font-awesome/css/font-awesome.css}"/>
    <link rel="stylesheet" th:href="@{/resources/valid/css/bootstrapValidator.css}"/>
    <link rel="stylesheet" th:href="@{/resources/layui/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/resources/css/website.css}"/>
</head>
<body class="childbody">
<div class="container-fluid editform_fluid">
    <!--Chart-box-->
    <div class="row-fluid">
        <div class="widget-box">
            <div class="widget-title"><span class="icon"> <i class="icon-align-justify"></i> </span>
                <h5>角色</h5>
            </div>
            <div class="widget-content">
                <form id="detailform" class="form-horizontal" th:object="${role}">
                    <input type="hidden" id="id" name="id" th:value="*{id}"/>
                    <div class="control-group">
                        <label class="control-label">角色名 :</label>
                        <div class="controls  form-group">
                            <input type="text" name="roleName" th:value="*{roleName}" class="span11 form-control" placeholder="请输入名称">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">编码 :</label>
                        <div class="controls  form-group">
                            <input type="text" name="roleCode" th:value="*{roleCode}" class="span11 form-control" placeholder="请输入编码">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">描述：</label>
                        <div class="controls form-group">
                            <textarea class="span11 form-control"  th:field="*{description}"  name="description"></textarea>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">权限 :</label>
                        <div class="controls form-group">
                            <table width="100%" border="0" cellspacing="0" cellpupdateing="0" class="info_table">
                                <tr  th:each="f : ${funcList}" th:if="${f.functionLevel == 0}">
                                    <td style="text-align:left;">
                                        <input type="checkbox" th:text="|${f.functionName}&nbsp;&nbsp;|" name="functionId" th:id="${f.id}" th:value="${f.id}" onclick="checkSub(this)" th:checked="${#lists.contains(existsFunctionIds, f.id)}"/>
                                    </td>
                                    <td colspan="3">
                                        <input type="checkbox" name="functionId" th:value="${sub.id}" th:class="${f.id}" th:each="sub : ${funcList}" th:if="${sub.TSFunction != null and sub.TSFunction.id.equals(f.id)}" th:text="|${sub.functionName}&nbsp;&nbsp;|"  th:checked="${#lists.contains(existsFunctionIds, sub.id)}"/>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <div class="form-actions">
                        <button id="btnSubmit" type="button" class="btn btn-success">确定</button>
                        <button id="btnClose" type="button" class="btn btn-primary">关闭</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script th:src="@{/resources/js/jquery.min.js}"></script>
<script th:src="@{/resources/js/jquery-migrate-1.2.1.js}"></script>
<script th:src="@{/resources/matrix/js/jquery.ui.custom.js}"></script>
<script th:src="@{/resources/matrix/js/bootstrap.min.js}"></script>
<script th:src="@{/resources/matrix/js/bootstrap-colorpicker.js}"></script>
<script th:src="@{/resources/matrix/js/bootstrap-datepicker.js}"></script>
<script th:src="@{/resources/matrix/js/masked.js}"></script>
<script th:src="@{/resources/matrix/js/jquery.uniform.js}"></script>
<script th:src="@{/resources/matrix/js/select2.min.js}"></script>
<script th:src="@{/resources/matrix/js/matrix.js}"></script>
<script th:src="@{/resources/matrix/js/jquery.peity.min.js}"></script>
<script th:src="@{/resources/layui/layui.all.js}" charset="utf-8"></script>
<script th:src="@{/resources/valid/js/bootstrapValidator.js}"></script>
<script th:src="@{/resources/valid/js/language/zh_CN.js}"></script>
<script th:src="@{/resources/js/website.js}"></script>
<script th:src="@{/resources/js/system.js}"></script>
<script th:src="@{/resources/js/validation_fields.js}"></script>
<script th:inline="javascript">
    var contextRoot = $("meta[name='context-path']").attr("content");
</script>

<script th:inline="javascript">
    /*<![CDATA[*/
    layui.use(['form', 'layer', 'table'], function () {
        var formUpdate = new FormEdit(layui.form, layui.layer, parent.edit, {
            url: contextRoot + "author_manage/role/doUpdateRole",
            getData: function () {
                return $("#detailform").serializeArray();
            }
        }, "detailform", ValidFields.role.add);
        $("#btnSubmit").bind("click", function (event) {
            formUpdate.submit();
        });
        $("#btnClose").bind("click", function (event) {
            formUpdate.close();
        });
    });

    function checkSub(obj) {
        var subClass = $(obj).prop("id");
        var checkStatus = $(obj).prop("checked");

        $("."+subClass).prop("checked", checkStatus);
    }
    /*]]>*/
</script>
</body>
</html>